#include<iostream>

using namespace std;

void solve()
{
    long long n, k; cin >> n >> k;
    int ans;
    if (k % 2 == 0) ans = k / 2;
    else
    {
        if (n % 2 == 0) ans = k / 2;
        else ans = k / 2 + 1;
    }
    if (ans % 2) cout << "NO" << endl;
    else cout << "YES" << endl;
}

int main()
{
    int t; cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}